﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using HZ.Supervise.Model.Enum;
using HZ.Supervise.Model;
using System.Data;
using HZ.Supervise.IBLL;

namespace HZ.Supervise.Web.Secondphase.NewReport
{
     public partial class HospitalWarn : BasePage
    {
         HZ.Supervise.IBLL.IExecuteContext ih = HZ.Supervise.BLLFactory.ExecuteContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ddlArea.InitAreaID = CurrentAccount.GetUser().Org.Area.AreaID;
                //SetBind();
            }
        }
        protected void SetBind()
        {
            string s ="";
            if (!string.IsNullOrEmpty(txtYear.Text.Trim()))
            {
                s += string.Format(" and CountYear='{0}'", txtYear.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtMonth.Text.Trim()))
            {
                s += string.Format(" and CountMonth='{0}'", txtMonth.Text.Trim());
            }
            if (ddlArea.SelectedAreaID == "510000")
            {
                s += "and areaid like '51%'";
            }
            else
            {
                s += "and areaid like '" + ddlArea.SelectedAreaID + "%'";
            }
            int totalrecord = 0;
            gvw.DataSource = ih.GetHospitalWarn(s, this.AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalrecord);
            gvw.DataBind();
            AspNetPager1.RecordCount = totalrecord;
        }
        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            SetBind();
        }
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
        }

    }
  
}
